package 进阶.线程.匿名方法创建线程;

public class demo01 {
    public static void main(String[] args) {

        //两种匿名创建线程方法

        //1.
        new Thread(){
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "hello world!!!" + "---"+ i);
                }
            }
        }.start();

        //2.
        Runnable r = new  Runnable(){
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "hello world!!!" + "---" + i);
                }
            }
        };

        new Thread(r).start();
    }
}
